/*
 * @Author: 汪圣哲 wanghist061@163.com
 * @Date: 2024-03-05 22:52:28
 * @LastEditors: 汪圣哲 wanghist061@163.com
 * @LastEditTime: 2024-03-07 16:50:56
 * @FilePath: \my_backstage\src\api\mockServe\permission.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import Mock from 'mockjs'
export default {
    getMenu: config => {
        const { username, password } = JSON.parse(config.body)
        // 先判断用户是否存在
        // 判断账号和密码是否对应
        if (username === 'admin' && password === 'admin') {
            return {
                code: 20000,
                data: {
                    menu: [{
                        path: '/home',
                        name: 'home',
                        text: '首页',
                        icon: 'icon-zhuye',
                        url: 'Home.vue',
                        color: '#f44336'
                    },
                    {
                        path: '/mall',
                        name: 'mall',
                        text: '商品管理',
                        icon: 'icon-yonghu',
                        url: 'Mall.vue',
                        color: '#ffa117'
                    },
                    {
                        path: '/user',
                        name: 'user',
                        text: '用户管理',
                        icon: 'icon-xiaoxi',
                        url: 'User.vue',
                        color: '#0fc70f'
                    },
                    {
                        path: '/page',
                        name: 'page',
                        text: '其他页面',
                        icon: 'icon-xiangji1',
                        url: 'Page.vue',
                        color: '#2196f3'
                    }],
                    token: Mock.Random.guid(),
                    message: '获取成功'
                }
            }
        } else if (username === 'xiaoxiao' && password === 'xiaoxiao') {
            return {
                code: 20000,
                data: {
                    menu: [
                        {
                            path: '/home',
                            name: 'home',
                            text: '首页',
                            icon: 'icon-zhuye',
                            url: 'Home.vue',
                            color: '#f44336'
                        },
                        {
                            path: '/mall',
                            name: 'mall',
                            text: '商品管理',
                            icon: 'icon-yonghu',
                            url: 'Mall.vue',
                            color: '#ffa117'
                        },
                    ],
                    token: Mock.Random.guid(),
                    message: '获取成功'
                }
            }
        } else {
            return {
                code: -999,
                data: {
                    message: '账号或密码错误'
                }
            }
        }
    }
}